
//
//  String+Extension.swift
//  新浪微博
//
//  Created by bin on 16/1/28.
//  Copyright © 2016年 XMG. All rights reserved.
//

import UIKit

extension String{
    
    func docPath() -> String{
        
        let doc = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask, true).last!
        return (doc as NSString).stringByAppendingPathComponent((self as NSString).pathComponents.last!)
    }
    
    func cachePath() -> String{
        
        let cachePath = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.CachesDirectory, NSSearchPathDomainMask.UserDomainMask, true).last!
        return (cachePath as NSString).stringByAppendingPathComponent((self as NSString).pathComponents.last!)
    }
    
    func tmpPath() -> String{
        
        let tmp = NSTemporaryDirectory()
        return (tmp as NSString).stringByAppendingPathComponent((self as NSString).pathComponents.last!)
    }
}
